 

program pole;
uses crt;
var a,b:byte;
    ile:integer;

    function f(x:real):real;
    begin
     f:=x*x-4;
    end;

    function p(a,x:real)   :real;
    begin
     if f(a)*f(b)<0 then
     p:=(abs(f(a))+abs(f(a+x)))/2*x
     else p:=abs(f(a)-f(a+x))/2*x;
    end;

    function pcalk(a,b:real; ile:integer):real;
    var t,x:real;i:integer;
    begin
    t:=0;
    x:=(b-a)/ile;
     for i:=0 to ile-1 do
       t:=t+p(a+i*x,x);
    pcalk:=t;
    end;

    begin
    writeln('pole=',pcalk(-2,2,10):2:3);
    readln;
    end.

